package ar.fiuba.tp7552.buildadmin.webactions.expensas;

import java.util.Collection;

import ar.fiuba.tp7552.buildadmin.model.builds.Edificio;
import ar.fiuba.tp7552.buildadmin.model.builds.Responsable;
import ar.fiuba.tp7552.buildadmin.model.expensas.Liquidacion;
import ar.fiuba.tp7552.buildadmin.service.EdificioService;
import ar.fiuba.tp7552.buildadmin.service.ExpensaService;
import ar.fiuba.tp7552.buildadmin.service.PermissionType;
import ar.fiuba.tp7552.buildadmin.service.ResponsableService;
import ar.fiuba.tp7552.buildadmin.webactions.BaseAction;

public class BuscarLiquidacionesAction extends BaseAction {

	private EdificioService edificioService;
	private ResponsableService responsableService;
	private ExpensaService expensaService;
	private Responsable responsable;
	private Edificio edificio;
	private Collection<Liquidacion> liquidaciones;

	// ~~ Constructor ====================================================
	
	public BuscarLiquidacionesAction(ExpensaService expensaService, 
			EdificioService edificioService, ResponsableService responsableService) {
		super();
		this.expensaService = expensaService;
		this.edificioService = edificioService;
		this.responsableService = responsableService;
	
	}
	
	public String load() {
		return BaseAction.SUCCESS;
	}
	
	public String search() {
		liquidaciones = expensaService.findLiquidaciones(edificio, responsable);
		return BaseAction.SUCCESS;
	}
	
	// ~~ getters y setters ========================================================
	
	public Collection<Edificio> getEdificios() {
		return edificioService.getAll(PermissionType.COBRO);
	}
	public Collection<Responsable> getResponsables() {
		return responsableService.getAll();
	}
	public Edificio getEdificio() {
		return edificio;
	}
	public void setEdificio(Edificio edificio) {
		this.edificio = edificio;
	}
	public void setResponsable(Responsable responsable) {
		this.responsable = responsable;
	}
	public Responsable getResponsable() {
		return responsable;
	}
	public Collection<Liquidacion> getLiquidaciones() {
		return liquidaciones;
	}
	public void setLiquidaciones(Collection<Liquidacion> liquidaciones) {
		this.liquidaciones = liquidaciones;
	}
}
